<?php
/**
 * [PHPFOX_HEADER]
 *
 * @copyright		[PHPFOX_COPYRIGHT]
 * @author  		Raymond Benc
 * @package  		Module_User
 * @version 		$Id: browse.html.php 6441 2013-08-12 11:48:59Z Raymond_Benc $
 * {* *}
 */

defined('PHPFOX') or exit('NO DICE!');

?>
<script>
    {literal}
        $Behavior.user_profile_link_span = function(){
            var base_url = $('#base_url').val();
            $('user_profile_link_span a').hover(function(e){
                e.preventDefault();
            })
            $('.user_profile_link_span a').click(function(e){
                e.preventDefault();
                var user_id = $(this).parent().parent().parent().parent().find('.row_user_id').val()
                document.location.href = base_url + "setting/user_" + user_id;
            });
            $('.user_browse_image a').click(function(e){
                e.preventDefault();
                var user_id = $(this).parent().parent().find('.row_user_id').val()
                document.location.href = base_url + "setting/user_" + user_id;
            });
            $('#memeber_invite').click(function(){
                document.location.href = base_url + "setting/username_" +{/literal} '{$username}'; {literal}
            })
        }
    {/literal}
</script>
{if defined('PHPFOX_IS_ADMIN_SEARCH')}


{else}

{if Phpfox::isMobile()}
<div class="header_bar_menu">														
	<div class="header_bar_search">
		<form method="post" action="{url link='user.browse' view=$sView}">
			<div><input type="hidden" name="search[submit]" value="1" /></div>
			<div class="header_bar_search_holder">
				{filter key='keyword'}
				<div class="header_bar_search_input"></div>
			</div>
		</form>
	</div>
</div>
{/if}
<input type="hidden" id="base_url" value="{url link='profiles'}">
{if count($aUsers)}
{foreach from=$aUsers name=users item=aUser}
<div itemscope itemtype="http://schema.org/Person">
	<meta itemprop="url" content="{url link=$aUser.user_name}" />
	
	{if Phpfox::getParam('user.user_browse_display_results_default') == 'name_photo_detail'}
		<div class="{if is_int($phpfox.iteration.users/2)}row1{else}row2{/if}{if $phpfox.iteration.users == 1} row_first{/if}" style="position:relative; height:110px;" id="js_parent_user_{$aUser.user_id}">
            <input type='hidden' class="row_user_id" value="{$aUser.user_id}">
			<div class="user_browse_info">
					<div style="font-size: 15px; font-weight: bold;" itemprop="name">
                        {$aUser|user:'':'':50|split:20}
                    </div>
					{if !empty($aUser.gender) && Phpfox::getUserGroupParam('' . $aUser.user_group_id . '', 'user.can_edit_gender_setting')}
					{$aUser.gender|gender} <br />
					{/if}
					{if Phpfox::getUserGroupParam('' . $aUser.user_group_id . '', 'user.can_edit_dob')}
					{if !empty($aUser.birthday) && $aUser.dob_setting != '3'}
					{if $aUser.dob_setting == '4'}
						{$aUser.month} {$aUser.day}, {$aUser.year} <br />
					{else}			
					{if $aUser.dob_setting == '1'}
						{$aUser.month} {$aUser.day}
					{elseif $aUser.dob_setting == '2'}
						{$aUser.birthday|age}
					{else}
						{$aUser.month} {$aUser.day}, {$aUser.year}
					{/if}
					<br />
					{/if}
	
					{/if}
					{/if}
					{if !empty($aUser.country_iso)}
					{if !empty($aUser.city_location)}{$aUser.city_location|clean} &raquo; {/if}{if !empty($aUser.country_child_id)}{$aUser.country_child_id|location_child} &raquo; {/if}{$aUser.country_iso|location} <br />
					{/if}
					{if Phpfox::isModule('rate') && Phpfox::getParam('profile.can_rate_on_users_profile') && $aUser.total_score > 0}
					{phrase var='user.total_score_out_of_10' total_score=$aUser.total_score|round}
					{/if}
					
				{if Phpfox::isModule('friend')}
				{if $aUser.mutual_friends > 0}
				<div class="user_browse_mutual_friend">
					<a href="#" onclick="$Core.box('friend.getMutualFriends', 300, 'user_id={$aUser.user_id}'); return false;">{if $aUser.mutual_friends == 1}
					{phrase var='user.1_mutual_friend'}
					{else}
					{phrase var='user.total_mutual_friends' total=$aUser.mutual_friends}
					{/if}</a>
				</div>
				{/if}
					{if Phpfox::isUser() && Phpfox::isModule('friend') && !$aUser.is_friend && $aUser.is_friend_request}
					<span class="extra_info">{phrase var='profile.pending_friend_request'}</span>
					{else}
					{if Phpfox::isUser() && Phpfox::isModule('friend') && !$aUser.is_friend && Phpfox::getUserId() != $aUser.user_id && (!isset($aUser.user_is_blocked) )}
						<div class="user_browse_add_friend">
							{img theme='misc/friend_added.png' class='v_middle'} <a href="#" onclick="return $Core.addAsFriend('{$aUser.user_id}');">{phrase var='user.add_friend'}</a>
						</div>
					{/if}
					{/if}
				{/if}				
			</div>		
			<div class="user_browse_image">
				{img user=$aUser suffix='_120_square' max_width=100 max_height=100 class='js_mp_fix_width'}	
			</div>
			<div class="clear"></div>
		</div>
	{else}
		<div class="go_left js_parent_user" style="{if Phpfox::isMobile()}width:44%;{else}width:100px;{/if} margin-bottom:10px;"  id="js_parent_user_{$aUser.user_id}">
			{img user=$aUser suffix='_120_square' max_width=100 max_height=100 class='js_mp_fix_width'}			
			<div class="user_browse_user">
				{$aUser|user:'':'':50}
				{if Phpfox::isModule('friend')}
				{if $aUser.mutual_friends > 0}
				<div class="user_browse_mutual_friend">
					<a href="#" onclick="$Core.box('friend.getMutualFriends', 300, 'user_id={$aUser.user_id}'); return false;">{if $aUser.mutual_friends == 1}
					{phrase var='user.1_mutual_friend'}
					  {else}
					{phrase var='user.total_mutual_friends' total=$aUser.mutual_friends}
					{/if}</a>
				</div>
				{/if}
				{if Phpfox::isUser() && Phpfox::isModule('friend') && !$aUser.is_friend && $aUser.is_friend_request}
				<div class="user_browse_add_friend">
					<span class="extra_info">{phrase var='profile.pending_friend_request'}</span>
				</div>
				{else}
				{if Phpfox::isUser() && Phpfox::isModule('friend') && !$aUser.is_friend && Phpfox::getUserId() != $aUser.user_id}
				<div class="user_browse_add_friend">
					{img theme='misc/friend_added.png' class='v_middle'} <a href="#" onclick="return $Core.addAsFriend('{$aUser.user_id}');">{phrase var='user.add_friend'}</a>
				</div>
				{/if}
				{/if}
				{/if}
			</div>
		</div>
		
		{if (!Phpfox::isMobile() && is_int($phpfox.iteration.users / 4)) || (Phpfox::isMobile() && is_int($phpfox.iteration.users / 2))}
		<div class="clear{if !Phpfox::isMobile()} js_parent_user_clear{/if}"></div>
		{/if}
	{/if}
</div>
{/foreach}
<div class="clear"></div>

{if !PHPFOX_IS_AJAX}
<div id="js_view_more_users"></div>
{/if}

{pager}

{/if}
{/if}
<div class="extra_info" style="font-size: 15px;">
    {phrase var='profiles.invite_members_message'}
</div>
<div class="table_clear">
    <input id="memeber_invite" value="{phrase var='profiles.invite'}" class="button" type="button">
</div>